package com.rpc.demo.client;


import com.rpc.demo.interfaces.RmiTestInterface;

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/*RMI 客户端*/
public class RmiClient {
	public static void main(String[] args) {
		try {
			Registry localhost = LocateRegistry.getRegistry("localhost", 2181);
			RmiTestInterface mytest = (RmiTestInterface) localhost.lookup("mytest");
			String test = mytest.getTest();
			System.out.println(test);
		} catch (RemoteException e) {
			e.printStackTrace();
		} catch (NotBoundException e) {
			e.printStackTrace();
		}
	}
}
